{% extends "gr/main.html" %}

{% block title %}Gift Registry: Event List{% endblock %}
{% block head %}{% endblock %}

{% block top %}
{% if request.session %}
Logged in as: {{ request.user }}
  (type: {{ request.user.get_profile.gr_user_type }})
{% else %}
(User not logged in)
{% endif %}
{% endblock %}

{% block content %}
<h1>Event List</h1>
{% if not request.user.get_profile.is_attendee %}
<div>
  <a href="add/">Create New Event</a>
</div>
{% endif %}
<table class='simple'>
  <tr>
    {% if not request.user.get_profile.is_attendee %}
    <th>rm</th>
    {% endif %}
    <th>Name</th>
    <th>Host</th>
    <th>Date</th>
    <th>Time</th>
    <th>Location</th>
  </tr>
  {% for e in events %}
  <tr>
    {% if not request.user.get_profile.is_attendee %}
    <td><a href="edit/{{ e.id }}/del">X</a></td>
    {% endif %}
    <td>
      <a href="view/{{ e.id }}">{{ e.name }}</a>
      {% if not request.user.get_profile.is_attendee %}
      (<a href="edit/{{e.id}}">Edit</a>)
      {% endif %}
    </td>
    <td>{{ e.recipient }}</td>
    <td>{{ e.date }}</td>
    <td>{{ e.time_start }} - {{ e.time_end }}</td>
    <td>{{ e.location }}</td>
  </tr>
  {% endfor %}
</table>
{% endblock %}


